
class Environment:
    
    gameState = 0
    whosBall = 0
    currentBall = 0
    lastBall = 0
    homeRobots = []
    opponentRobots = []
    
    def __init__(self, list):
        self.gameState, self.whosBall, self.currentBall, self.lastBall, self.homeRobots, self.opponentRobots = list
        
    def __str__(self):
        string = " GameState "+str(self.gameState)+"\n WhosBall "+str(self.whosBall)
        
        string = string + "\n CurrentBall "
        string = string + str(self.currentBall)
        string = string + "\n LastBall "
        string = string + str(self.lastBall)
        
        string = string + "\n MyRobots \n"
        i = 0
        for r in self.homeRobots:
            string = string + "\t" +"[" + str(i) +"]" + str(r) + "\n"
            i = i + 1
            
        string = string + "\n OpponentRobots \n"
        i = 0
        for r in self.opponentRobots:
            string = string + "\t" +"[" + str(i) +"]" + str(r) + "\n"
            i = i + 1
            
        return string
    
    def toSend(self):
        s = ""
        for r in self.homeRobots:
            if s == "":
                s = s+ r.toSend()
            else:
                s = s+":"+ r.toSend()
        return s
        
        
